Skip to content

Conversation

@ludfjig
Copy link
Contributor

@ludfjig ludfjig commented Jan 28, 2026

Avoid stale Cargo.lock being checked in. This is annoying because rust-analyzer will rebuild them locally and update Cargo.lock, resulting in locally modified Cargo.lock files, which can interfere with git operations (like git checkout).

Most complications come from the fact that dependabot will update dependencies (like hyperlight-common dependencies) without rebuilding guests resulting in the guest's Cargo.lock being outdated after a dependabot PR

Prior art:

Note: since this will modify dependabot PRs, commands like @dependabot rebase won't work. Would need to do @dependabot recreate isntead, since dependabot won't rebase if somebody else touched the PR

- name: Update simpleguest Cargo.lock
if: steps.check-ecosystem.outputs.is_cargo == 'true'
working-directory: src/tests/rust_guests/simpleguest
run: cargo update
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is cargo update more aggressive than we want here? IIUC cargo update would update all deps to the latest compatible version, whereas I wonder if cargo update simpleguest to do only the updates that are necessary to make the lockfiles consistent would be useful to make the PRs a bit more granular and isolate the effect of a dependency with a failing update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps building the guest would do the minimal necessary updates. I'm not sure cargo update simpleguest would work

Copy link
Contributor Author

@ludfjig ludfjig Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually cargo fetch should probably do it! (without the --locked)

@syntactically
Copy link
Member

@ludfjig Absolutely no pressure if you have higher-priority things, but is there anything we should do to progress this? It's only a tiny papercut, but I am constantly running into the out-of-date guest lock files because I now use Nix-vendored dependencies, which makes them a bit annoying (have to get a cargo executable not configured for vendoring, fix the lock file, wait for the dev environment to rebuild, etc).

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig ludfjig added the kind/bugfix For PRs that fix bugs label Feb 11, 2026
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent stale, checked-in Cargo.lock files (especially for Rust test guests) by enforcing lockfile freshness in CI and adding automation to update guest lockfiles on Dependabot PRs.

Changes:

  • Enforce --locked cargo fetch for each Rust guest crate (simpleguest/dummyguest/witguest) in local just CI-like checks.
  • Enforce the same guest lockfile checks in the reusable CI workflow (dep_code_checks.yml).
  • Add a new workflow to auto-update and push guest Cargo.lock files on Dependabot cargo PRs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
Justfile Adds cargo fetch --manifest-path … --locked checks for each Rust guest crate.
.github/workflows/dep_code_checks.yml Extends the existing lockfile freshness check to include each Rust guest crate.
.github/workflows/dependabot-update-guest-locks.yml New workflow to regenerate guest lockfiles and push them back to Dependabot PR branches.

Comment on lines +119 to +122
# Commit with DCO sign-off
git commit --signoff -m "chore: update guest Cargo.lock files" \
-m "Automatically updated by dependabot-update-guest-locks workflow." \
-m "Triggered by: ${DEPENDENCY_NAMES}"
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow creates a commit with git commit --signoff, but the repo’s contribution policy requires commits to be GPG-signed as well. As written, the automation will produce unsigned commits, which can violate the signing requirement and potentially block merges. Consider either importing a GPG key in the workflow and using git commit -S -s, or switching to an approach that produces GitHub-verified commits (e.g., committing via the GitHub API) while still including the DCO sign-off line.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bugfix For PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants